package com.study.configuration;

import com.alibaba.druid.sql.SQLUtils;
import com.study.component.mybatis.MyBatisInterceptor;
import java.util.function.Supplier;
import org.apache.ibatis.plugin.Interceptor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author tanglingyu
 * @Date: 2021/07/01/ 15:40
 * @Description
 */
@Configuration
@ConditionalOnClass({SQLUtils.class, Interceptor.class})
public class MybatisConfig {

  @Bean
  public MyBatisInterceptor mybatisInterceptor() {
    Supplier<MyBatisInterceptor> supplier = MyBatisInterceptor::new;
    return supplier.get();
  }
}

